<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <meta name="format-detection" content="telephone=no" />
    <title>快讯</title>
    <link rel="stylesheet" href="../../css/reset.css">
    <style>
        body {
            width: 100%;
            font-size: 0.28rem;
            /* height: "auto"; */
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            font-family: PingFang-SC-Medium;
            color: #262626;
            padding-top: 1rem;
        }

        #showNews>p {
            width: 100%;
            height: 0.6rem;
            background: rgba(247, 247, 247, 0.92);
            font-size: 0.24rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            color: rgba(144, 158, 172, 1);
            padding-left: 0.31rem;
            box-sizing: border-box;
            font-weight: 500;
        }

        #newsList {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        #newsList li {
            width: 6.84rem;
            border-left: 1px solid rgba(210, 210, 210, 0.34);
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: space-between;
            align-items: center;
            padding-left: 0.15rem;
            box-sizing: border-box;
        }

        #newsList li>p {
            width: 100%;
            height: 0.6rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            font-size: 0.24rem;
            font-weight: bold;
            color: rgba(144, 158, 172, 1);
            position: relative;
        }

        #newsList li>p>span {
            position: absolute;
            left: -0.22rem;
            top: 0.22rem;
            width: 0.1rem;
            height: 0.1rem;
            border-radius: 100%;
            border: 1px solid #909EAC;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
        }

        #newsList li>p>span>i {
            width: 0.06rem;
            height: 0.06rem;
            border-radius: 100%;
            background-color: #909eac;
        }

        #newsList li>b {
            width: 100%;
            padding: 0 0 0.15rem 0;
            font-size: .28rem;
            font-family: PingFang-SC-Bold;
            letter-spacing: 0.02rem;
            display: flex;
            display: -webkit-flex;
            justify-content: flex-start;
            font-weight: bold;
            color: rgba(38, 38, 38, 1);
        }

        #newsList li>div {
            width: 6.7rem;
            font-size: 0.28rem;
            font-weight: 300;
            color: rgba(89, 89, 89, 1);
            background: rgba(247, 247, 247, 0.83);
            letter-spacing: 0.02rem;
            padding: 0 0.34rem;
            border-top: 0.25rem solid rgba(247, 247, 247, 0.83);
            border-bottom: 0.25rem solid rgba(247, 247, 247, 0.83);
            box-sizing: border-box;
            text-align: justify;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 4;
            overflow: hidden;
        }

        #newsList li>span {
            width: 100%;
            height: 0.72rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-start;
        }

        #newsList li>span>img {
            width: 0.36rem;
            height: 0.28rem;
        }

        /* 深度 */
        #deepnews {
            width: 100%;
            padding: 0 0.3rem;
            box-sizing: border-box;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            justify-content: center;
        }

        #deepnews>p {
            width: 100%;
            height: 0.64rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-start;
            font-size: 32px;
        }

        #deepnews>p img {
            width: 0.36rem;
            height: 0.36rem;
            border-radius: 100%;
            margin-right: 0.14rem;
        }

        #deepnews>p>b {
            font-size: 0.32rem;
            font-family: PingFang-SC-Bold;
            font-weight: bold;
        }

        #deepnews .hotNews {
            width: 100%;
            height: auto;
            padding-bottom: 0.16rem;
            border-bottom: 1px solid #ececec;
            display: flex;
            display: -webkit-flex;
            justify-content: space-between;
            overflow-x: scroll;
            -webkit-overflow-scrolling: touch;
        }

        #deepnews .hotNews>div {
            width: 2.2rem;
            height: 100%;
        }

        #deepnews .hotNews>div>p {
            width: 100%;
            height: 1.44rem;
            margin-bottom: 0.2rem;
            display: block;
            overflow: hidden;
            text-align: center;
        }

        #deepnews .hotNews div:not(:last-of-type) {
            margin-right: 0.1rem;
        }

        #deepnews .hotNews p>img {
            width: 2.2rem;
            height: 1.44rem;
            margin-bottom: 0.2rem;
        }

        #deepnews .hotNews>div>span {
            width: 2.2rem;
            height: auto;
            font-size: .28rem;
            font-family: PingFang-SC-Medium;
            font-weight: 500;
            color: #595959;
            overflow: hidden;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            text-align: left;
        }

        #deepnews>ul>li {
            width: 100%;
            height: auto;
            padding: 0.4rem 0 0.3rem 0;
            border-bottom: 1px solid #ececec;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 0.2rem;
            height: 1.6rem;
            position: relative;
        }

        #deepnews>ul>li>div {
            flex: 1;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            justify-content: space-between;
            height: 1.3rem;
            box-sizing: border-box;
        }

        #deepnews>ul>li>span {
            width: 1.72rem;
            height: auto;
            margin-left: 0.4rem;
            display: block;
            text-align: center;
        }

        #deepnews>ul>li>span>img {
            width: 1.7rem;
            height: 1.3rem;
        }

        #deepnews>ul>li>div>b {
            flex: 1;
            font-size: 0.3rem;
            font-family: PingFang-SC-Bold;
            font-weight: bold;
            margin-bottom: 0.1rem;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }

        #deepnews>ul>li>div>p {
            width: 100%;
            height: 0.25rem;
            border-radius: 2px;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-start;
            padding-top: 0.1rem;
        }

        .tobottom {
            font-size: 0.26rem;
            text-align: center;
            line-height: 1rem;
            color: #656565
        }

        #deepnews>ul>li>div>p>.isTop {
            background: #ffd203;
            padding: 0 0.1rem;
            border-radius: 0.04rem;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
        }

        #deepnews>ul>li>div>p>span:last-of-type {
            height: 0.25rem;
            border-radius: 2px;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
            margin-left: 0.12rem;
            color: #898989;
        }

        /* 动态 */
        #dynamicNews {
            width: 100%;
            padding: 0 0.3rem;
            box-sizing: border-box;
        }

        #dynamicNews>ul>.dynamicNewsOne {
            width: 100%;
            height: auto;
            padding: 0.4rem 0 0.3rem 0;
            border-bottom: 1px solid #ececec;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
        }

        #dynamicNews>ul>.dynamicNewsOne>div {
            flex: 1;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
        }

        #dynamicNews>ul>.dynamicNewsOne>img {
            width: 1.72rem;
            margin-left: 0.4rem;
        }

        #dynamicNews>ul>.dynamicNewsOne>div>b {
            flex: 1;
            font-size: 0.3rem;
            font-family: PingFang-SC-Bold;
            font-weight: bold;
            margin-bottom: 0.34rem;
        }

        #dynamicNews>ul>.dynamicNewsOne>div>p {
            width: 100%;
            height: 0.25rem;
            border-radius: 2px;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-start;
        }

        #dynamicNews>ul>.dynamicNewsOne>div>p>span:first-of-type {
            width: 0.5rem;
            height: 0.25rem;
            background: #ffd203;
            border-radius: 0.04rem;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
        }

        #dynamicNews>ul>.dynamicNewsOne>div>p>span:last-of-type {
            height: 0.25rem;
            border-radius: 2px;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
            margin-left: 0.12rem;
            color: #898989;
        }

        #dynamicNews>ul>.dynamicNewsTwo {
            width: 100%;
            height: 1.6rem;
            padding: 0.4rem 0 0.3rem 0;
            border-bottom: 1px solid #ececec;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
        }

        #dynamicNews>ul>.dynamicNewsTwo>b {
            width: 100%;
            font-size: 0.3rem;
            font-family: PingFang-SC-Bold;
            font-weight: bold;
            margin-bottom: 0.4rem;
        }

        #dynamicNews>ul>.dynamicNewsTwo>p {
            width: 100%;
            height: 0.25rem;
            border-radius: 0.04rem;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-start;
        }

        #dynamicNews>ul>.dynamicNewsTwo>p>span:first-of-type {
            width: 0.5rem;
            height: 0.25rem;
            background: #ffd203;
            border-radius: 0.04rem;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
        }

        #dynamicNews>ul>.dynamicNewsTwo>p>span:last-of-type {
            height: 0.25rem;
            border-radius: 2px;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
            margin-left: 0.12rem;
            color: #898989;
        }

        #dynamicNews>ul>.dynamicNewsThree {
            width: 100%;
            padding: 0.4rem 0 0.3rem 0;
            border-bottom: 1px solid #ececec;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
        }

        #dynamicNews>ul>.dynamicNewsThree>b {
            width: 100%;
            font-size: 0.3rem;
            font-family: PingFang-SC-Bold;
            font-weight: bold;
            margin-bottom: 0.2rem;
        }

        #dynamicNews>ul>.dynamicNewsThree>p {
            width: 100%;
            height: 0.25rem;
            border-radius: 0.04rem;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-start;
        }

        #dynamicNews>ul>.dynamicNewsThree>p>span:first-of-type {
            width: 0.5rem;
            height: 0.25rem;
            background: #ffd203;
            border-radius: 0.04rem;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
        }

        #dynamicNews>ul>.dynamicNewsThree>p>span:last-of-type {
            height: 0.25rem;
            border-radius: 2px;
            font-size: 0.18rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
            margin-left: 0.12rem;
            color: #898989;
        }

        #dynamicNews>ul>.dynamicNewsThree>div {
            width: 100%;
            display: flex;
            display: -webkit-flex;
            justify-content: space-between;
            margin-bottom: 0.2rem;
        }

        #dynamicNews>ul>.dynamicNewsThree>div>img {
            width: 2.2rem;
        }
    </style>
</head>

<body>
    <!-- 快讯 -->
    <div id="showNews" style="background-color: #fff;display: block">
        <p id="todayTime">
        </p>
        <ul id="newsList">
            <!-- <li>
        <p>
            2019-07-17 17:43:55 <span><i></i> </span>
        </p>
        <b>
            墨西哥加密货币交易所Bitso于今日发布公告称,已获得直布罗陀金
        </b>
        <div>
            墨西哥加密货币交易所Bitso于今日发布公告称,已获得直布罗陀金融服务委员会(GFSC)的DLT许可证公司称在遵守直布罗陀加密货币监管制度的同时仍将继续与墨西哥当地金融监管机构进行。
        </div>
        <span>
            <img src="../../image/share.png">
        </span>
    </li>
    <li>
        <p>
            2019-07-17 17:43:55 <span><i></i> </span>
        </p>
        <b>
            墨西哥加密货币交易所Bitso于今日发布公告称,已获得直布罗陀金
        </b>
        <div>
            墨西哥加密货币交易所Bitso于今日发布公告称,已获得直布罗陀金融服务委员会(GFSC)的DLT许可证公司称在遵守直布罗陀加密货币监管制度的同时仍将继续与墨西哥当地金融监管机构进行。
        </div>
        <span>
            <img src="../../image/share.png">
        </span>
    </li> -->
        </ul>
        <div id="newtext" style="width: 100%;text-align: center;margin: auto;color: #666666;padding-bottom: 0.2rem;">

        </div>
    </div>
    <!-- 深度 -->
    <div id="deepnews" style="background-color: #fff;padding-top: 0.5rem;display: none;">
        <p><img src="../../image/hotnews.png" style="width:0.36rem;height:0.36rem;"> <b>热门</b></p>
        <div class="hotNews">
        </div>
        <ul id="showDeepsList">
            <!-- <li>
            <div>
                <b>
                    钓鱼台国宾馆今日下午将进行讨论Libra的活动
                </b>
                <p>
                    <span>置顶</span>
                    <span>人人矿场 · 6分钟前</span>
                </p>
            </div>
            <span>
                <img src="../../image/user_img_bigx.png" alt="">
            </span>
        </li> -->
        </ul>
        <div class="tobottom">加载中</div>
    </div>
    <!-- 快讯 -->
    <script id="listNews" type="text/html">
    {{~it:value:index}}
    <li>
        <p>
            {{=value.create_time}} <span><i></i> </span>
        </p>
        <b>
            {{=value.title}}
        </b>
        <div data-flag='true'>
            {{=value.content}}
        </div>
        <!-- data-txt='{{=value.content}}' -->
        <span data-txt='{{=value.content}}' data-qrtxt="{{=value.qrtxt}}" data-title="{{=value.title}}"
              data-date="{{=value.create_time}}" data-weekday="{{=value.weekday}}">
            <img src="../../image/hlshare.png">
        </span>
    </li>
    {{~}}
</script>
    <!--热门-->
    <script id="hotMb" type="text/html">
    {{~it:value:index}}
    <div data-id="{{=value.id}}">
        <p>
            <img src={{=value.face_url}}>
        </p>
        <span>{{=value.title}}</span>
    </div>
    {{~}}
    </script>
    <!--    <iframe src="" frameborder="0" style="display: none;" width="100%" height="100%"></iframe>-->
</body>

</html>
<!--深度-->
<script id="deepMb2" type="text/html">
    {{~it:value:index}}
    <li data-id="{{=value.id}}">
        <div>
            <b>{{=value.title}}</b>
            <p>
                {{?value.istopfive}}
                <span class="isTop">置顶</span>
                {{?}}
                <span style="font-size:.24rem;margin-left:{{=value.istopfive?'0.12rem':0}}">人人矿场 · {{=value.product_at}}</span>
            </p>
        </div>
        {{?value.face_url}}
        <span>
            <img src={{=value.face_url}} alt="">
        </span>
        {{?}}
    </li>
    {{~}}
</script>
<script src="../../script/autosize.js"></script>
<script src="../../script/jquery_three_two_one.js"></script>
<script src="../../script/fastclick.js"></script>
<script src="../../script/dotmin.js"></script>
<script src="../../script/app.js"></script>
<script>
    apiready = function () {
        var app = new APP();
        var thisItem = "showNews"; //头部选择 默认选中第一个
        var account = app.getAccount();
        var thisPage = 1, totalPage = 1; //快讯当前页 总页数
        var hotPage = 1, hotTotalpage = 1; //深度当前页，总页数
        var ajaxAccount = 0; //深度请求ajax成功数
        var newsList = []; //快讯
        //动态资讯
        function showNewsList(page, isdown) {
            app.ajaxPro({
                url: "newsletter/lists",
                values: {
                    page: page,
                    pageSize: "20"
                },
                openFlower: false
            }, function (ret) {
                totalPage = ret.data.total_page;
                var thisData = new Date(); //获取当前时间
                var thisMonth = thisData.getMonth() + 1;
                thisMonth = Number(thisMonth) < 10 ? ("0" + thisMonth) : thisMonth;
                var thisDay = thisData.getDate();
                thisDay = Number(thisDay) < 10 ? ("0" + thisDay) : thisDay;
                var weekDay = "";
                var weekday = new Array(7);
                weekday[0] = "星期天";
                weekday[1] = "星期一";
                weekday[2] = "星期二";
                weekday[3] = "星期三";
                weekday[4] = "星期四";
                weekday[5] = "星期五";
                weekday[6] = "星期六";
                weekDay = thisMonth + "月" + thisDay + "日" + " " + weekday[thisData.getDay()];
                $("#todayTime").text(weekDay);
                app.for(ret.data.latest_newsletter, function (r) {
                    var item = r.item;
                    // 处理换行符
                    // var newContent = item.content.replace(new RegExp());
                    // 计算星期
                    var createTime = item.create_time;
                    item.content = item.content.replace(/(\n)/g, "");
                    item.content = item.content.replace(/(\t)/g, "");
                    item.content = item.content.replace(/(\r)/g, "");
                    item.content = item.content.replace(/<\/?[^>]*>/g, "");
                    item.content = item.content.replace(/\s*/g, "");
                    item.content = item.content.replace(/\n/g, "<br>");
                    var first = createTime.split(" ")[0];
                    var second = createTime.split(" ")[1];
                    var splits1 = first.split("-");
                    var splits2 = second.split(":");
                    var result = new Date(parseInt(splits1[0]), parseInt(splits1[1]) - 1, parseInt(splits1[2]), parseInt(splits2[0]), parseInt(splits2[1]), parseInt(splits2[2]));
                    var weekday = new Array(7);
                    weekday[0] = "星期天";
                    weekday[1] = "星期一";
                    weekday[2] = "星期二";
                    weekday[3] = "星期三";
                    weekday[4] = "星期四";
                    weekday[5] = "星期五";
                    weekday[6] = "星期六";
                    ret.data.latest_newsletter[r.index].weekday = weekday[result.getDay()];
                    //正式
                    // ret.data.latest_newsletter[r.index].qrtxt = app.wapUrl + "html/#/register?inviter_uid=" + (account ? account.uid : "");
                    ret.data.latest_newsletter[r.index].qrtxt = app.wapUrl + (account ? account.uid : "");
                    /*快讯邀请链接修改*/
                });
                // 渲染模板
                var temp = doT.template($("#listNews").text());
                if (isdown) {
                    newsList = ret.data.latest_newsletter;
                    $("#newsList").html(temp(ret.data.latest_newsletter));
                } else {
                    $("#newsList").append(temp(ret.data.latest_newsletter));
                    for (var i = 0; i < ret.data.latest_newsletter.length; i++) {
                        newsList.push(ret.data.latest_newsletter[i]);
                    }
                }
                app.closeFlower();
                if (thisPage == 1 && ret.data.latest_newsletter.length == 0) {
                    $("#newtext").text("暂时没有相关数据");
                }
                if (thisPage == totalPage && totalPage >= 1 && ret.data.latest_newsletter.length > 0) {
                    $("#newtext").text("没有更多了");
                }
            })
        }
        showNewsList(thisPage, true);
        //深度资讯点击
        function bindDeep() {
            function goPage(id, kind) {
                var pageValue = {
                    name: "news_detail",
                    subpage: "mine/news_detail",
                    title: "资讯详情",
                    param: {
                        pageName: "news_detail",
                        id: id,
                        kind: kind
                    }
                }
                app.setNavBarAttr(pageValue);
            }
            $("#showDeepsList").on("click", "li", function () {
                goPage($(this).data("id"), $(this).data("kind"))
            });
            $(".hotNews").on("click", "div", function () {
                goPage($(this).data("id"), $(this).data("kind"))
            });
        }
        //深度资讯
        var deepListarr = []; //深度列表
        function deepnewsList(page, isdown) {
            app.flower();
            function hideFlower() {
                ajaxAccount++;
                if (ajaxAccount >= 2) {
                    ajaxAccount = 2;
                    app.flower.close();
                    bindDeep();
                }
            }
            app.ajaxPro({
                url: "article/get-list",
                values: {
                    kind: 2,
                    page: 1,
                    size: 3
                },
                openFlower: true
            }, function (ret, err) {
                if (ret.data.lists) {
                    var temp = doT.template($("#hotMb").text());
                    var appList = ret.data.lists.splice(0, 3);
                    $(".hotNews").html(temp(appList));
                }
                hideFlower()
            })
            app.ajaxPro({
                url: "article/get-list",
                values: {
                    page: hotPage,
                    kind: 1
                },
                openFlower: true
            }, function (ret, err) {
                if (ret) {
                    hotTotalpage = ret.data.totalpage;
                    var temp2 = doT.template($("#deepMb2").text());
                    if (isdown) {
                        deepListarr = [];
                        deepListarr = ret.data.lists;
                    } else {
                        for (var i = 0; i < ret.data.lists.length; i++) {
                            deepListarr.push(ret.data.lists[i]);
                        }
                    }
                    deepListarr.map(function (item) {
                        if (item.kind == 1) {
                            item.istopfive = true;
                        }
                    })
                    $("#showDeepsList").html(temp2(deepListarr));
                    if (hotPage == 1 && hotTotalpage == 0) {
                        $(".tobottom").text("暂时没有相关数据");
                    }
                    if (hotPage >= hotTotalpage && hotTotalpage > 0) {
                        $(".tobottom").text("已经到底了");
                    }
                    if (hotPage < hotTotalpage && hotTotalpage > 0) {
                        $(".tobottom").text("加载更多");
                    }

                }
                hideFlower();
            }
            );
        }
        //资讯点击事件
        $("#newsList").on("click", "li>div", function (params) {
            var moreNode = $(this).attr("data-flag");
            if (moreNode == "true") {
                $(this).css({
                    display: "block",
                    height: "auto"
                });
                $(this).attr("data-flag", "false");
            } else {
                $(this).css({
                    display: "-webkit-box"
                });
                $(this).attr("data-flag", "true");
            }
        })
        $("#newsList").on("click", "li>span", function (e) {
            e.stopPropagation();
            var thizIndex = $(this).index();
            var shareTxt = $(this).data("txt");
            var shareQrTxt = $(this).data("qrtxt");
            var shareTitle = $(this).data("title");
            var shareDate = $(this).data("date");
            var weekday = $(this).data("weekday");
            var param = {
                dtype: "dialog191",
                data: {
                    title: "",
                    text: "",
                    btns: [{
                        name: "取消",
                        event: "cancel_img_share"
                    }],
                    lis: [{
                        name: "微信",
                        event: "img_share",
                        index: 0
                    },
                    {
                        name: "朋友圈",
                        event: "img_share",
                        index: 1
                    },
                    {
                        name: "QQ",
                        event: "img_share",
                        index: 2
                    },
                    {
                        name: "新浪微博",
                        event: "img_share",
                        index: 3
                    }
                    ],
                    extra: {
                        shareTxt: shareTxt,
                        shareQrTxt: shareQrTxt,
                        shareDate: shareDate,
                        shareTitle: shareTitle,
                        weekday: weekday,
                        showBottom: true
                    }
                }
            };
            app.dialog(param);
            app.listen('img_share', function (ret) {
                var wxMd, qqMd, sinaMd;
                var index = ret.value.index;
                var img_url = ret.value.imgPath;
                switch (index) {
                    case 0:
                        if (!wxMd) {
                            wxMd = api.require("wxPlus");
                        }
                        //检测是否装有微信
                        wxMd.isInstalled(function (r, e) {
                            if (r.installed) {
                                wxMd.shareImage({
                                    scene: 'session',
                                    contentUrl: img_url
                                }, function (r, err) {
                                    if (r.status) {
                                        app.toast("分享成功");
                                    } else {
                                        app.log("分享失败回错误码", e.code);
                                        if (err.code == 2) {
                                            app.toast("取消分享");
                                        } else {
                                            app.toast("分享失败");
                                        }
                                    }
                                }
                                );
                            } else {
                                app.toast("当前设备未安装微信客户端");
                            }
                        });
                        break;
                    case 1:
                        if (!wxMd) {
                            wxMd = api.require("wxPlus");
                        }
                        //检测是否装有微信
                        wxMd.isInstalled(function (r, e) {
                            if (r.installed) {
                                wxMd.shareImage({
                                    scene: "timeline",
                                    thumb: "widget://res/web/images/shareicon.png",
                                    contentUrl: img_url
                                }, function (r, err) {
                                    if (r.status) {
                                        app.toast("分享成功");
                                    } else {
                                        if (err.code == 2) {
                                            app.toast("取消分享");
                                        } else {
                                            app.toast("分享失败");
                                        }
                                    }
                                }
                                );
                            } else {
                                app.toast("当前设备未安装微信客户端");
                            }
                        });
                        break;
                }
            })
        });
        function getLives(params) {
            app.ajaxPro({
                url: "live/get-live",
                values: {
                    token: account ? account.token : ""
                },
                openFlower: true
            }, function (ret) {
                if (ret.code == 200) {
                    var iframe = document.createElement("iframe");
                    iframe.id = 'livesNode';
                    iframe.width = '100%';
                    iframe.height = '100%';
                    iframe.src = ret.data.uri;
                    document.body.appendChild(iframe);
                }
            })
        }
        //监听头部选择
        var choseValue = 'showNews';
        app.listen("newsChooseItem", function (ret, err) {
            thisItem = ret.value;
            thisPage = 1;
            totalPage = 1;
            $("body>div").hide();
            $("#" + ret.value).show();
            if (ret.value != "tvLivs") {
                $("body #livesNode").remove();
            }
            $("body").scrollTop(100);
            if (ret.value == "showNews") {
                if (choseValue == ret.value) return;
                $("#newsList").empty();
                showNewsList(thisPage, true);
                return
            }
            if (ret.value == "deepnews") {
                $("#showDeepsList,.hotNews").empty();
                hotPage = 1;
                hotTotalpage = 1;
                ajaxAccount = 0;
                deepnewsList(thisPage, true);
                return
            }
            if (ret.value == "tvLivs") {
                $("#showDeepsList,.hotNews").empty();
                getLives();
                return
            }
        });
        app.listen("reloadNews", function () {
            app.reload();
        })
        //加载更多
        app.toBottom(function () {
            if (thisPage < totalPage && thisItem == "showNews") {
                thisPage++;
                showNewsList(thisPage, false);
                return
            }
            if (hotPage < hotTotalpage && thisItem == "deepnews") {
                hotPage++;
                deepnewsList(hotPage, false);
                return
            }
        });
        //下拉刷新
        app.downRefresh(function () {
            thisPage = 1;
            totalPage = 1;
            hotPage = 1;
            hotTotalpage = 1;
            ajaxAccount = 0;
            if (thisItem == "showNews") {
                $("#newsList").empty();
                showNewsList(thisPage, true);
                return
            }
            if (thisItem == "deepnews") {
                $("#showDeepsList,.hotNews").empty();
                deepnewsList(hotPage, true);
                return
            }
        });
        app.listen("needLogin", function () {
            app.closeF("newsheader");
            app.goLogin();
        });
        var xiaoeUrl = "";
        function getSmellUrl() {
            var account = app.getAccount();
            if (!account) return
            app.ajaxPro({
                url: "live/get-xiaoe",
                values: {
                    token: account.token,
                },
                openFlower: false
            }, function (ret) {
                if (ret.code == 200) {
                    xiaoeUrl = ret.data.uri;
                }
            })
        }
        getSmellUrl();
        app.listen("openXiaoetong", function (params) {
            var account = app.getAccount();
            if (!account) {
                app.trigger("needLogin");
                app.toast("该操作需要登录");
                return
            }
            // app.openWin({
            //     name: "xiaoetong",
            //     url: app.hd + "activihtml/xiaoetong.html",
            //     slidBackEnabled: false
            // })
            var xeShopSDK = api.require('xeShopSDK');
            xeShopSDK.init();
            xeShopSDK.setTitle({
                title: "V讲堂"
            });
            xeShopSDK.setNavStyle({
                titleColor: "#333333",//l1标题颜色
                titleFontSize: 18,//1l标题字体大小
                backgroundColor: "tteeeeee",//Il标题栏背景
                backlconlmageName: "image/back_icon.png",//l返回按钮图片名称
                closelconImageName: "imagelclose_icon.png",//ll关闭按钮图片名称
                sharelconImageName: "imagelshare_icon.png"//l分享按钮图片名称
            });
            // SDK回调
            var callback = function (ret, err) {
                if (ret) {
                    if (ret.code == 501) {
                        app.ajaxPro({
                            url: "live/xiaoe-login",
                            values: {
                                token: account.token,
                            },
                            openFlower: true
                        }, function (ret) {
                            if (ret.code == 200) {
                                if (ret.data) {
                                    xeShopSDK.synchronizeToken({
                                        token_key: ret.data.token_key,
                                        token_value: ret.data.token_value
                                    })
                                }
                            }
                        })
                    }
                    if (ret.code == 503) {
                        var userConfig = {
                            recommendTitle: "人人矿场算力公学",
                            recommendText: "深入浅出算力真知,生动解读算力世界,离矿友最近的课堂",
                            recommendUrl: xiaoeUrl,
                            recommendImg: "widget://image/shareicon.png"
                        };
                        var wxMd = api.require("wxPlus");
                        if (app.ST != "ios") {
                            wxMd.isInstalled(function (r, e) {
                                if (r.installed) {
                                    wxMd.shareWebpage({
                                        scene: "session",
                                        title: userConfig.recommendTitle,
                                        description: userConfig.recommendText,
                                        thumb: userConfig.recommendImg,
                                        contentUrl: userConfig.recommendUrl
                                    }, function (r, e) {
                                        if (r.status) {
                                            if (app.ST == "ios") {
                                                app.toast("分享成功");
                                            }
                                        } else {
                                            app.toast("分享失败");
                                        }
                                    });
                                } else {
                                    app.toast("当前设备未安装微信客户端");
                                }
                            });
                            return
                        }
                        app.sheet({
                            buttons: ["微信", "微信(朋友圈)"],
                            cancelTitle: "取消"
                        }, function (ret, err) {
                            if (ret.buttonIndex == 1) {
                                wxMd.isInstalled(function (r, e) {
                                    if (r.installed) {
                                        wxMd.shareWebpage({
                                            scene: "session",
                                            title: userConfig.recommendTitle,
                                            description: userConfig.recommendText,
                                            thumb: userConfig.recommendImg,
                                            contentUrl: userConfig.recommendUrl
                                        }, function (r, e) {
                                            if (r.status) {
                                                app.toast("分享成功");
                                            } else {
                                                app.toast("分享失败");
                                            }
                                        });
                                    } else {
                                        app.toast("当前设备未安装微信客户端");
                                    }
                                });
                                return
                            }
                            if (ret.buttonIndex == 2) {
                                wxMd.isInstalled(function (r, e) {
                                    if (r.installed) {
                                        wxMd.shareWebpage({
                                            scene: "timeline",
                                            title: userConfig.recommendTitle,
                                            description: userConfig.recommendText,
                                            thumb: userConfig.recommendImg,
                                            contentUrl: userConfig.recommendUrl
                                        }, function (r, e) {
                                            if (r.status) {
                                                app.toast("分享成功");
                                            } else {
                                                app.toast("分享失败");
                                            }
                                        });
                                    } else {
                                        app.toast("当前设备未安装微信客户端");
                                    }
                                });
                            }
                        })
                    };
                } else {
                    console.log(JSON.stringify(err));
                };
            }
            xeShopSDK.open({ url: xiaoeUrl }, callback);
            // https://appvY6LzveU1306.h5.xiaoeknow.com
            //退出登录小鹅通
            // xeShopSDK.logoutSDK();
        })
    };
</script>